<?php echo $this->Session->flash(); ?>
<h1>ESTUDIOS REALIZADOS AL PREDIO  <?php echo$cod; ?></h1>
<div id="loading" style="display: none;">
    <?php echo $html->image('loading.gif', array('border' => "0", 'align' => 'center')); ?>
</div>
<table  id="tabla" class="tabla" >
    <thead>
        <tr>
            <th>Id</th>
            <th>Calificación</th>
            <th>Concepto</th>
            <th>recomendaciones</th>
            <th colspan="2"></th>
        </tr>
    </thead>
    <tbody>
        <?php
        if ($this->Session->read('publicado') == 0)
            $habilitar = true;
        else
            $habilitar = false;
        foreach ($studies as $prop):

            switch ($prop['TitleStudy']['calificacion']) {
                case 0:
                    $r = "Sin Registro";
                    break;
                case 1:
                    $r = "Cumple";
                    break;
                case 2:
                    $r = "No Cumple";
                    break;
                case 3:
                    $r = "Subsanable";
                    break;
                default:
                    break;
            }
            ?>
            <tr>
                <td><?php echo $prop['TitleStudy']['id'] ?></td>
                <td><?php echo $r ?></td>
                <td><?php echo $prop['TitleStudy']['concepto'] ?></td>
                <td><?php echo $prop['TitleStudy']['recomendaciones'] ?></td>
                <td><?php if ($habilitar) echo $ajax->link($html->image('editar.gif', array('width' => '30', 'heigth' => '30', 'alt' => 'Editar estudio')), array('controller' => 'title_studies', 'action' => 'edit', $prop['TitleStudy']['id']), array('update' => 'content', 'complete' => 'cargar()', 'indicator' => 'loading', 'escape' => false)); ?></td>
                <td><?php if ($habilitar) echo $ajax->link($html->image('borrar.png', array('width' => '30', 'heigth' => '30', 'alt' => 'Borrar estudio')), array('controller' => 'title_studies', 'action' => 'delete', $prop['TitleStudy']['id'], $predio), array('update' => 'content', 'complete' => 'cargar()', 'indicator' => 'loading', 'escape' => false), 'Desea borrar el registro?'); ?></td>
            </tr>
            <?php
            $habilitar = false;
        endforeach;
        ?>
    </tbody>
</table>
<br>
<br>
<?php
if ($this->Session->read('publicado') == 0)
    echo $ajax->link('<label>Adicionar Estudio</label>' . $html->image('adicionar.gif', array('width' => '30', 'heigth' => '30', 'alt' => 'Adicionar estudio')), array('controller' => 'title_studies', 'action' => 'add', $predio), array('update' => 'content', 'complete' => 'cargar()', 'indicator' => 'loading', 'escape' => false));
?>